/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

HCM.HITPreview = new (function() {
    var root_el;
    
    this.onReady = function(el) {
        root_el=el;

        $(root_el).find('.tabsNav li:nth-child(3)').click(function(){
            oWindow=window.open('', 'HITPreview');
            var HITDesignEditor = FCKeditorAPI.GetInstance('HITDesignEditor') ;

            var sHTML = '<html>' +
            '<head>' +
            '<meta content="text/html; charset=utf-8" http-equiv="Content-Type">' +
            '<title>' + 'Preview' + '</title>' +
            '<link rel="stylesheet" type="text/css" href="/js/fckeditor/editor/skins/default/fck_editor.css">' +
            '</head><body>' +
            HITDesignEditor.GetHTML() +
            '</body></html>' ;
            oWindow.document.write(sHTML);
            //            oWindow.document.write(oFCKeditor.Value);
            oWindow.document.close();
        });
    };
});

function FCKeditor_OnComplete( editorInstance )
{
    if (editorInstance.Name=='HITDesignEditor') {
        HCM.HITPreview.onReady($("div.tabs"));
    }
}